package b.p.b;

import android.content.Context;
import android.graphics.PointF;
import android.util.DisplayMetrics;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LinearInterpolator;
import androidx.recyclerview.widget.RecyclerView.v;

/* compiled from: LinearSmoothScroller */
public class t extends v {
    public final LinearInterpolator i = new LinearInterpolator();
    public final DecelerateInterpolator j = new DecelerateInterpolator();
    public PointF k;
    public final DisplayMetrics l;
    public boolean m = false;
    public float n;
    public int o = 0;
    public int p = 0;

    public t(Context context) {
        this.l = context.getResources().getDisplayMetrics();
    }

    /* JADX WARNING: Removed duplicated region for block: B:31:? A:{SYNTHETIC, RETURN} */
    /* JADX WARNING: Removed duplicated region for block: B:29:0x00a9  */
    /* JADX WARNING: Removed duplicated region for block: B:16:0x004c  */
    /* JADX WARNING: Removed duplicated region for block: B:29:0x00a9  */
    /* JADX WARNING: Removed duplicated region for block: B:31:? A:{SYNTHETIC, RETURN} */
    public void c(android.view.View r11, androidx.recyclerview.widget.RecyclerView.w r12, androidx.recyclerview.widget.RecyclerView.v.a r13) {
        /*
        r10 = this;
        r12 = r10.k;
        r0 = 1;
        r1 = -1;
        r2 = 0;
        r3 = 0;
        if (r12 == 0) goto L_0x0015;
    L_0x0008:
        r12 = r12.x;
        r12 = (r12 > r3 ? 1 : (r12 == r3 ? 0 : -1));
        if (r12 != 0) goto L_0x000f;
    L_0x000e:
        goto L_0x0015;
    L_0x000f:
        if (r12 <= 0) goto L_0x0013;
    L_0x0011:
        r9 = 1;
        goto L_0x0016;
    L_0x0013:
        r9 = -1;
        goto L_0x0016;
    L_0x0015:
        r9 = 0;
    L_0x0016:
        r12 = r10.c;
        if (r12 == 0) goto L_0x0047;
    L_0x001a:
        r4 = r12.g();
        if (r4 != 0) goto L_0x0021;
    L_0x0020:
        goto L_0x0047;
    L_0x0021:
        r4 = r11.getLayoutParams();
        r4 = (androidx.recyclerview.widget.RecyclerView.LayoutParams) r4;
        r5 = r12.F(r11);
        r6 = r4.leftMargin;
        r5 = r5 - r6;
        r6 = r12.I(r11);
        r4 = r4.rightMargin;
        r6 = r6 + r4;
        r7 = r12.P();
        r4 = r12.p;
        r12 = r12.Q();
        r8 = r4 - r12;
        r4 = r10;
        r12 = r4.e(r5, r6, r7, r8, r9);
        goto L_0x0048;
    L_0x0047:
        r12 = 0;
    L_0x0048:
        r4 = r10.k;
        if (r4 == 0) goto L_0x0059;
    L_0x004c:
        r4 = r4.y;
        r3 = (r4 > r3 ? 1 : (r4 == r3 ? 0 : -1));
        if (r3 != 0) goto L_0x0053;
    L_0x0052:
        goto L_0x0059;
    L_0x0053:
        if (r3 <= 0) goto L_0x0057;
    L_0x0055:
        r9 = 1;
        goto L_0x005a;
    L_0x0057:
        r9 = -1;
        goto L_0x005a;
    L_0x0059:
        r9 = 0;
    L_0x005a:
        r0 = r10.c;
        if (r0 == 0) goto L_0x008c;
    L_0x005e:
        r1 = r0.h();
        if (r1 != 0) goto L_0x0065;
    L_0x0064:
        goto L_0x008c;
    L_0x0065:
        r1 = r11.getLayoutParams();
        r1 = (androidx.recyclerview.widget.RecyclerView.LayoutParams) r1;
        r2 = r0.J(r11);
        r3 = r1.topMargin;
        r5 = r2 - r3;
        r11 = r0.D(r11);
        r1 = r1.bottomMargin;
        r6 = r11 + r1;
        r7 = r0.R();
        r11 = r0.q;
        r0 = r0.O();
        r8 = r11 - r0;
        r4 = r10;
        r2 = r4.e(r5, r6, r7, r8, r9);
    L_0x008c:
        r11 = r12 * r12;
        r0 = r2 * r2;
        r0 = r0 + r11;
        r0 = (double) r0;
        r0 = java.lang.Math.sqrt(r0);
        r11 = (int) r0;
        r11 = r10.g(r11);
        r0 = (double) r11;
        r3 = 4599717252057688074; // 0x3fd57a786c22680a float:7.853492E26 double:0.3356;
        r0 = r0 / r3;
        r0 = java.lang.Math.ceil(r0);
        r11 = (int) r0;
        if (r11 <= 0) goto L_0x00b0;
    L_0x00a9:
        r12 = -r12;
        r0 = -r2;
        r1 = r10.j;
        r13.b(r12, r0, r11, r1);
    L_0x00b0:
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: b.p.b.t.c(android.view.View, androidx.recyclerview.widget.RecyclerView$w, androidx.recyclerview.widget.RecyclerView$v$a):void");
    }

    public int e(int i, int i2, int i3, int i4, int i5) {
        if (i5 == -1) {
            return i3 - i;
        }
        if (i5 == 0) {
            i3 -= i;
            if (i3 > 0) {
                return i3;
            }
            i4 -= i2;
            return i4 < 0 ? i4 : 0;
        } else if (i5 == 1) {
            return i4 - i2;
        } else {
            throw new IllegalArgumentException("snap preference should be one of the constants defined in SmoothScroller, starting with SNAP_");
        }
    }

    public float f(DisplayMetrics displayMetrics) {
        return 25.0f / ((float) displayMetrics.densityDpi);
    }

    public int g(int i) {
        float abs = (float) Math.abs(i);
        if (!this.m) {
            this.n = f(this.l);
            this.m = true;
        }
        return (int) Math.ceil((double) (abs * this.n));
    }
}
